package com.qidian.mes.pro.controller;

import com.qidian.mes.pojo.Technique;
import com.qidian.mes.pro.service.TechniqueService;
import com.qidian.mes.util.dot.PagerDTO;
import com.qidian.mes.util.pojo.QdResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author dqy
 * @Description
 * @Time 2024/4/11 16:46
 */
@RestController
@RequestMapping("/technique")
@CrossOrigin
public class TechniqueController {
    @Autowired
    private TechniqueService techniqueService;

    @PostMapping("saveTechnique")
    public QdResult saveTechnique(@RequestBody Technique technique) {
        return techniqueService.saveTechnique(technique);
    }
    @RequestMapping("/queryAll")
    public QdResult<List<Technique>> queryAll() {
        return techniqueService.queryAll();
    }
    @GetMapping("/queryById")
    public QdResult<Technique> queryById(Long techniqueId) {
        return techniqueService.queryById(techniqueId);
    }
    @GetMapping("/queryByPage")
    public QdResult<PagerDTO<Technique>> queryByPage(Technique technique, @RequestParam(defaultValue = "1") int page, @RequestParam(defaultValue = "10") int limit) {
        return techniqueService.queryByPage(technique, page, limit);
    }
    @GetMapping("/delete")
    public QdResult deleteTechnique(Long techniqueId) {
        return techniqueService.deleteById(techniqueId);
    }
    @PostMapping("/update")
    public QdResult updateTechnique(@RequestBody Technique technique) {
        return techniqueService.updateTechnique(technique);
    }
    @GetMapping("/deletes")
    public QdResult deletes(Long [] techniqueIds) {
        return techniqueService.deletes(techniqueIds);
    }
}
